package com.lam.framework.bean.entity;

import java.util.Date;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lam.common.base.domain.BaseEntity;
import com.lam.common.components.dict.annotation.Dict;
import com.lam.common.components.easyexcel.converter.DictConverter;
import com.lam.common.utils.DateUtil;

/**
 * 操作日志记录对象 sys_oper_log
 *
 * @author admin
 * @date 2022-08-03
 */
@ColumnWidth(30)
@TableName("sys_oper_log")
public class SysOperLog implements BaseEntity {

    /**
     * 主键
     */
    @ExcelIgnore
    @TableId(type = IdType.AUTO)
    private String id;

    /**
     * 模块标题
     */
    @ExcelProperty("模块标题")
    private String title;

    /**
     * 操作描述
     */
    @ExcelProperty("操作描述")
    private String oper;

    /**
     * 业务类型（query-查询 insert-新增 update-修改 delete-删除 import-导入 export-导出 download-下载 other-其他）
     */
    @ExcelProperty(value = "业务类型", converter = DictConverter.class)
    @Dict(dictCode = "business_type")
    private String businessType;

    /**
     * 操作类别（a-后台，f-前端app, o-其它）
     */
    @ExcelProperty(value = "操作类别", converter = DictConverter.class)
    @Dict(dictCode = "operator_type")
    private String operatorType;

    /**
     * 保存参数(1是 0否)
     */
    @ExcelProperty(value = "保存参数", converter = DictConverter.class)
    @Dict(dictCode = "yn10")
    private Integer saveReqData;

    /**
     * 保存结果(1是 0否)
     */
    @ExcelProperty(value = "保存结果", converter = DictConverter.class)
    @Dict(dictCode = "yn10")
    private Integer saveResData;

    /**
     * 日志打印参数(1是 0否)
     */
    @ExcelProperty(value = "日志打印参数", converter = DictConverter.class)
    @Dict(dictCode = "yn10")
    private Integer printReqData;

    /**
     * 日志打印结果(1是 0否)
     */
    @ExcelProperty(value = "日志打印结果", converter = DictConverter.class)
    @Dict(dictCode = "yn10")
    private Integer printResData;

    /**
     * 打印耗时(1是 0否)
     */
    @ExcelProperty(value = "打印耗时", converter = DictConverter.class)
    @Dict(dictCode = "yn10")
    private Integer elapsedTime;

    /**
     * 打印来源ip(1是 0否)
     */
    @ExcelProperty(value = "打印来源ip", converter = DictConverter.class)
    @Dict("yn10")
    private Integer printIp;

    /**
     * 方法名称
     */
    @ExcelProperty("方法名称")
    private String handler;

    /**
     * 请求方式
     */
    @ExcelProperty("请求方式")
    private String reqMethod;

    /**
     * 请求URL
     */
    @ExcelProperty("请求URL")
    private String reqUrl;

    /**
     * 请求参数
     */
    @ExcelProperty("请求参数")
    private String reqParam;

    /**
     * 执行参数
     */
    @ExcelProperty("执行参数")
    private String operParam;

    /**
     * 请求ip
     */
    @ExcelProperty("请求ip")
    private String reqIp;

    /**
     * 浏览器类型
     */
    @ExcelProperty("浏览器类型")
    private String browser;

    /**
     * 操作系统
     */
    @ExcelProperty("操作系统")
    private String os;

    /**
     * 返回结果
     */
    @ExcelProperty("返回结果")
    private String resResult;

    /**
     * 操作状态（SUCCESS-成功 FAIL-失败 EXCEPTION-异常）
     */
    @ExcelProperty(value = "操作状态", converter = DictConverter.class)
    @Dict(dictCode = "req_status_type")
    private String reqStatus;

    /**
     * 操作状态描述
     */
    @ExcelProperty("操作状态描述")
    private String reqDesc;

    /**
     * 请求耗时
     */
    @ExcelProperty("请求耗时")
    private Long elTime;

    /**
     * 操作时间
     */
    @ExcelProperty("操作时间")
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    private Date operTime;

    /**
     * 操作人员
     */
    @ExcelProperty("操作人员")
    private String operName;

    /**
     * 备注
     */
    @ExcelProperty("备注")
    private String remark;

    /**
     * 操作人员id
     */
    @ExcelIgnore
    private String operId;

    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    public void setOper(String oper) {
        this.oper = oper;
    }

    public String getOper() {
        return oper;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setOperatorType(String operatorType) {
        this.operatorType = operatorType;
    }

    public String getOperatorType() {
        return operatorType;
    }

    public void setSaveReqData(Integer saveReqData) {
        this.saveReqData = saveReqData;
    }

    public Integer getSaveReqData() {
        return saveReqData;
    }

    public void setSaveResData(Integer saveResData) {
        this.saveResData = saveResData;
    }

    public Integer getSaveResData() {
        return saveResData;
    }

    public void setPrintReqData(Integer printReqData) {
        this.printReqData = printReqData;
    }

    public Integer getPrintReqData() {
        return printReqData;
    }

    public void setPrintResData(Integer printResData) {
        this.printResData = printResData;
    }

    public Integer getPrintResData() {
        return printResData;
    }

    public void setElapsedTime(Integer elapsedTime) {
        this.elapsedTime = elapsedTime;
    }

    public Integer getElapsedTime() {
        return elapsedTime;
    }

    public void setPrintIp(Integer printIp) {
        this.printIp = printIp;
    }

    public Integer getPrintIp() {
        return printIp;
    }

    public void setHandler(String handler) {
        this.handler = handler;
    }

    public String getHandler() {
        return handler;
    }

    public void setReqMethod(String reqMethod) {
        this.reqMethod = reqMethod;
    }

    public String getReqMethod() {
        return reqMethod;
    }

    public void setReqUrl(String reqUrl) {
        this.reqUrl = reqUrl;
    }

    public String getReqUrl() {
        return reqUrl;
    }

    public void setReqParam(String reqParam) {
        this.reqParam = reqParam;
    }

    public String getReqParam() {
        return reqParam;
    }

    public void setOperParam(String operParam) {
        this.operParam = operParam;
    }

    public String getOperParam() {
        return operParam;
    }

    public void setReqIp(String reqIp) {
        this.reqIp = reqIp;
    }

    public String getReqIp() {
        return reqIp;
    }

    public void setBrowser(String browser) {
        this.browser = browser;
    }

    public String getBrowser() {
        return browser;
    }

    public void setOs(String os) {
        this.os = os;
    }

    public String getOs() {
        return os;
    }

    public void setResResult(String resResult) {
        this.resResult = resResult;
    }

    public String getResResult() {
        return resResult;
    }

    public void setReqStatus(String reqStatus) {
        this.reqStatus = reqStatus;
    }

    public String getReqStatus() {
        return reqStatus;
    }

    public void setReqDesc(String reqDesc) {
        this.reqDesc = reqDesc;
    }

    public String getReqDesc() {
        return reqDesc;
    }

    public void setElTime(Long elTime) {
        this.elTime = elTime;
    }

    public Long getElTime() {
        return elTime;
    }
    
    public String getElTimeText() {
        return DateUtil.convertTimeLong(elTime);
    }

    public void setOperTime(Date operTime) {
        this.operTime = operTime;
    }

    public Date getOperTime() {
        return operTime;
    }

    public void setOperName(String operName) {
        this.operName = operName;
    }

    public String getOperName() {
        return operName;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getRemark() {
        return remark;
    }

    public String getOperId() {
        return operId;
    }

    public void setOperId(String operId) {
        this.operId = operId;
    }
}
